﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Collections;

namespace MultilangXML
{
    public partial class FrmLogon : Form
    {
        public FrmLogon()
        {
            InitializeComponent();
        }

        private void FrmLogon_Load(object sender, EventArgs e)
        {
            MultiLanguage.lang = MultiLanguage.ReadDefaultLanguage();
            MultiLanguage.getNames(this);

            IList list = MultiLanguage.GetLanguageList(MultiLanguage.lang);
            comboBox1.Items.Add(list[0].ToString());
            comboBox1.Items.Add(list[1].ToString());

        }

        private void btnchangepwd_Click(object sender, EventArgs e)
        {
            Form frmpasswordchange = new FrmPasswordChange();
            frmpasswordchange.Show();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex==0)
            {
                MultiLanguage.lang = "ZH";
                MultiLanguage.WriteDefaultLanguage(MultiLanguage.lang);

            }
            else
            {
                MultiLanguage.lang = "EN";
                MultiLanguage.WriteDefaultLanguage(MultiLanguage.lang);
            }
            foreach (Form Frm in Application.OpenForms)
            {
                MultiLanguage.getNames(Frm);

            }
            IList list = MultiLanguage.GetLanguageList(MultiLanguage.lang);
            comboBox1.Items.Clear();
            comboBox1.Items.Add(list[0].ToString());
            comboBox1.Items.Add(list[1].ToString());
        }
    }
}
